package com.linwen.javase.desgin_pattern.action.command;

/**
 * @ClassName Command
 * @Description
 * @Author lin
 * @Date 2022/6/26 下午10:29
 * @Version V1.0
 */
public abstract class Command {   //指令抽象，不同的电器有指令

    private final Receiver receiver;

    protected Command(Receiver receiver){   //指定此命令对应的电器（接受者）
        this.receiver = receiver;
    }

    public void execute() {
        receiver.action();   //执行命令，实际上就是让接收者开始干活
    }
}
